import 'dart:convert';

import 'package:date_format/date_format.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_hotwork/bean/BaseBean.dart';
import 'package:flutter_hotwork/bean/LoadForecastBean.dart';
import 'package:flutter_hotwork/bean/LoadForecastingList.dart';
import 'package:flutter_hotwork/home/RoadChoice.dart';
import 'package:flutter_hotwork/homepage/BaseTitleBar.dart';
import 'package:flutter_hotwork/homepage/BaseViewBar.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter_hotwork/utils/DioUtils.dart';
import '../LoadingDialog.dart';
import '../Myapplication.dart';
import '../Toast.dart';
import 'TextWeidge.dart';

class fuheyucescreen extends StatefulWidget {
  @override
  ChartPageState createState() => ChartPageState();
}


class SeriesDatas {
  final int time;
  final double data;


  SeriesDatas(this.time, this.data);
}
class ChartPageState extends State<fuheyucescreen> {
//手机号的控制器
  TextEditingController phoneController = TextEditingController();
  TextEditingController hourController = TextEditingController();
  Map selectArea;
  String _year;
  double _sales;
  bool hasdata=false;
  var searchType=0;//0单个1全部
  FocusNode _commentFocus = FocusNode();
  GlobalKey<TextWidgetState> textKey = GlobalKey();  //设置key,绑定待刷新控件.
  LoadForecastBean quxianbean;
  var sel = 0;
  TabController _tabController;
  @override
  Widget build(BuildContext context) {
    return
      new MaterialApp(
        home:
        Scaffold(
          appBar:
          new BaseViewBar(
              childView: new BaseTitleBar(
                "负荷预测",
                leftIcon: 'images/fanhui.png',
                rightIcon:  "",
                rightClick: () {
                  print("点击了右边干嘛啊。。。哦");
                },
                leftClick: () {
                  Navigator.of(context).pop();
                  print("点击了左边干嘛啊。。。哦");
                },
              ),
              preferredSize: Size.fromHeight(50.0)),

          body:
              new CustomScrollView(
                shrinkWrap: true,
                // 内容
                slivers: <Widget>[
                  new SliverPadding(
                    padding: const EdgeInsets.all(0),
                    sliver: new SliverList(
                      delegate: new SliverChildListDelegate(
                        <Widget>[


                          Container(
                            child: Row(
                              children: [
                                Container(
                                  margin:  EdgeInsets.only(left: 0, right: 0, top:5, bottom: 5),
                                  child:
                                  InkWell(
                                    onTap: (){
                                      showModalBottomSheet(context: context,builder: (_)=>Container(
                                        height: 200.0,
                                        child: AreaSelection(
                                          onSelect: handleSelect,
                                          initProviceIndex: selectArea == null ? 0 : selectArea['proviceIndex'],
                                          initCityIndex: selectArea == null ? 0 : selectArea['cityIndex'],
                                        ),
                                      ));
                                    },
                                    child:
                                    Container(
                                        height: 20,
                                        margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                        padding:  EdgeInsets.only(left: 2, right: 0, top:0, bottom: 0),
                                        decoration: BoxDecoration(
                                          border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                          color: Colors.white, // 底色
                                          //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                                        ),
                                        child:
                                        Row(
                                          children: [
                                            Container(
                                              width:100,
                                              child:
                                              Text(selectArea != null ? selectArea['address'] : "请选择用户"  ,
                                                style: TextStyle(color: Colors.black,fontSize: 10),
                                                overflow: TextOverflow.ellipsis,
                                              ) ,
                                            ),

                                            Container(width: 5,),
                                            Image.asset(
                                              'images/jiantou.png',
                                              width: 14.0,
                                              height: 20.0,
                                            ),
                                          ],
                                        )
                                    ),
                                  ),
                                ),

                                // FlatButton(
                                //   onPressed: () {
                                //     DatePicker.showDatePicker(context,
                                //         // 是否展示顶部操作按钮
                                //         showTitleActions: true,
                                //         // 最小时间
                                //         minTime: DateTime(2018, 3, 5),
                                //         // 最大时间
                                //         maxTime: DateTime(2099, 6, 7),
                                //         // change事件
                                //         onChanged: (date) {
                                //
                                //           print('change $date');
                                //         },
                                //         // 确定事件
                                //         onConfirm: (date) {
                                //           time = formatDate(date,[yyyy,'-',mm,"-",dd]);
                                //           time2 = formatDate(date,[yyyy,'-',mm]);
                                //           getFuHeList();
                                //           // setState(() {
                                //           //
                                //           // });
                                //           print('confirm $time');
                                //         },
                                //         // 当前时间
                                //         currentTime: DateTime.now(),
                                //         // 语言
                                //         locale: LocaleType.zh);
                                //   },
                                //   child:
                                //   Container(
                                //       width: 100,
                                //       height: 20,
                                //       margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                //       padding:  EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                //       decoration: BoxDecoration(
                                //         border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                //         color: Colors.white, // 底色
                                //         //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                                //       ),
                                //       child:
                                //       Row(
                                //         children: [
                                //           Image.asset(
                                //             'images/rili.png',
                                //             width: 14.0,
                                //             height: 20.0,
                                //           ),
                                //           Container(width: 5,),
                                //           Text(
                                //             '$time',
                                //             style: TextStyle(color: Colors.black,fontSize: 10),
                                //           )
                                //
                                //         ],
                                //       )
                                //   ),
                                // ),

                                InkWell(
                                  onTap: (){
                                    searchType=0;
                                    getFuHeList();
                                  },
                                  child:
                                  Container(
                                      width: 50,
                                      height: 20,
                                      margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                      padding:  EdgeInsets.only(left: 2, right: 2, top:0, bottom: 0),
                                      decoration: BoxDecoration(
                                        // border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                        color: Colors.blue, // 底色
                                        borderRadius: new BorderRadius.circular((5.0)), // 圆角度
                                      ),
                                      child:
                                      Row(
                                        mainAxisAlignment:MainAxisAlignment.center,
                                        children: [
                                          Text("查询",
                                            style: TextStyle(color: Colors.white,fontSize: 10),
                                          )
                                        ],
                                      )
                                  ),
                                ),
                                MyApplication.loginuserinfo.userInfo.amHotuser!=1?
                                InkWell(
                                  onTap: (){
                                    searchType=1;
                                    getFuHeList();
                                  },
                                  child:
                                  Container(
                                      width: 50,
                                      height: 20,
                                      margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                      padding:  EdgeInsets.only(left: 2, right: 2, top:0, bottom: 0),
                                      decoration: BoxDecoration(
                                        // border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                        color: Colors.blue, // 底色
                                        borderRadius: new BorderRadius.circular((5.0)), // 圆角度
                                      ),
                                      child:
                                      Row(
                                        mainAxisAlignment:MainAxisAlignment.center,
                                        children: [
                                          Text("查询全部",
                                            style: TextStyle(color: Colors.white,fontSize: 10),
                                          )
                                        ],
                                      )
                                  ),
                                ):Container(),
                              ],
                            ),
                          ),
                          hasdata?
                          Column(
                            children: [
                             searchType==0?Column(children: [
                                Container(
                                  height: 20,
                                ),
                                quxianbean.result[0].readStatus==0?
                                InkWell(
                                  onTap: (){
                                    updatefuheyuceread();
                                  },
                                  child:
                                  Container(
                                      width: 50,
                                      height: 20,
                                      margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                      padding:  EdgeInsets.only(left: 2, right: 2, top:0, bottom: 0),
                                      decoration: BoxDecoration(
                                        // border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                        color: Colors.blue, // 底色
                                        borderRadius: new BorderRadius.circular((5.0)), // 圆角度
                                      ),
                                      child:
                                      Row(
                                        mainAxisAlignment:MainAxisAlignment.center,
                                        children: [
                                          Text("已读",
                                            style: TextStyle(color: Colors.white,fontSize: 10),
                                          )
                                        ],
                                      )
                                  ),
                                ):Container(),
                                Container(
                                  height: 20,
                                ),
                                Text("修改负荷预测值",style: TextStyle(fontSize: 14),),
                                sel==0?
                                Row(
                                  children: <Widget>[
                                    Container(
                                      width: 10,
                                    ),
                                    Text("预测所选时间（填入小时）：",style: TextStyle(fontSize: 12),),

                                    Container(
                                      width: 90,
                                      height: 20,
                                      margin: EdgeInsets.only(left: 15),
                                      padding:  EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                      decoration: BoxDecoration(
                                        border: new Border.all(color: Color(0xFF9E9E9E), width: 0.5), // 边色与边宽度
                                        color: Colors.white, // 底色
                                        //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                                        borderRadius: BorderRadius.all(Radius.circular(15)),
                                      ),
                                      child:
                                      TextField(
                                        inputFormatters: [WhitelistingTextInputFormatter(RegExp("[0-9.]")),],//只允许输入数字
                                        style: TextStyle(color: Colors.grey),
                                        controller: hourController,
                                        // controller: phoneController,
                                        keyboardType: TextInputType.number,
                                        decoration: InputDecoration(
                                          contentPadding: EdgeInsets.all(10.0),

                                          hintStyle: TextStyle(color: Colors.grey),
//                            helperText: '请输入注册的手机号',
                                          border:InputBorder.none,
                                        ),
                                        autofocus: false,
                                      ),

                                    ),
                                    Container(
                                      width: 10,
                                    ),
                                  ],
                                ):Row(
                                  children: <Widget>[
                                    Container(
                                      width: 10,
                                    ),
                                    Text("预测所选日期：",style: TextStyle(fontSize: 12),),

                                    FlatButton(
                                      onPressed: () {
                                        DatePicker.showDatePicker(context,
                                            // 是否展示顶部操作按钮
                                            showTitleActions: true,
                                            // 最小时间
                                            minTime: DateTime(2018, 3, 5),
                                            // 最大时间
                                            maxTime: DateTime(2099, 6, 7),
                                            // change事件
                                            onChanged: (date) {

                                              print('change $date');
                                            },
                                            // 确定事件
                                            onConfirm: (date) {
                                              time = formatDate(date,[yyyy,'-',mm,"-",dd]);
                                              time2 = formatDate(date,[yyyy,'-',mm]);
                                              getFuHeList();
                                              // setState(() {
                                              //
                                              // });
                                              print('confirm $time');
                                            },
                                            // 当前时间
                                            currentTime: DateTime.now(),
                                            // 语言
                                            locale: LocaleType.zh);
                                      },
                                      child:
                                      Container(
                                          width: 100,
                                          height: 20,
                                          margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                          padding:  EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                          decoration: BoxDecoration(
                                            border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                            color: Colors.white, // 底色
                                            //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                                          ),
                                          child:
                                          Row(
                                            children: [
                                              Image.asset(
                                                'images/rili.png',
                                                width: 14.0,
                                                height: 20.0,
                                              ),
                                              Container(width: 5,),
                                              Text(
                                                '$time',
                                                style: TextStyle(color: Colors.black,fontSize: 10),
                                              )

                                            ],
                                          )
                                      ),
                                    ),

                                    Container(
                                      width: 10,
                                    ),
                                  ],
                                ),
                                Container(
                                  height: 20,
                                ),
                                Row(
                                  children: <Widget>[
                                    Container(
                                      width: 10,
                                    ),
                                    Text("预测所选日期用汽量(t)：",style: TextStyle(fontSize: 12),),

                                    Container(
                                      width: 90,
                                      height: 20,
                                      margin: EdgeInsets.only(left: 15),
                                      padding:  EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                      decoration: BoxDecoration(
                                        border: new Border.all(color: Color(0xFF9E9E9E), width: 0.5), // 边色与边宽度
                                        color: Colors.white, // 底色
                                        //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                                        borderRadius: BorderRadius.all(Radius.circular(15)),
                                      ),
                                      child:
                                      TextField(
                                        inputFormatters: [WhitelistingTextInputFormatter(RegExp("[0-9.]")),],//只允许输入数字
                                        style: TextStyle(color: Colors.grey),
                                        controller: phoneController,
                                        focusNode: _commentFocus,
                                        // controller: phoneController,
                                        keyboardType: TextInputType.number,
                                        decoration: InputDecoration(
                                          contentPadding: EdgeInsets.all(10.0),

                                          hintStyle: TextStyle(color: Colors.grey),
//                            helperText: '请输入注册的手机号',
                                          border:InputBorder.none,
                                        ),
                                        autofocus: false,
                                      ),

                                    ),
                                    Container(
                                      width: 10,
                                    ),
                                    InkWell(
                                      onTap: (){
                                        _commentFocus.unfocus();
                                        updatefuheyuce();

                                        // getmaxandminList();
                                      },
                                      child:
                                      Container(
                                          width: 50,
                                          height: 20,
                                          margin: EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                                          padding:  EdgeInsets.only(left: 2, right: 2, top:0, bottom: 0),
                                          decoration: BoxDecoration(
                                            // border: new Border.all(color: Colors.blue, width: 0.5), // 边色与边宽度
                                            color: Colors.blue, // 底色
                                            borderRadius: new BorderRadius.circular((5.0)), // 圆角度
                                          ),
                                          child:
                                          Row(
                                            mainAxisAlignment:MainAxisAlignment.center,
                                            children: [
                                              Text("修改",
                                                style: TextStyle(color: Colors.white,fontSize: 10),
                                              )
                                            ],
                                          )
                                      ),
                                    ),
                                  ],
                                ),


                              ],):Container(),


                              _chartWidget(),
                            ],
                          )
                              :
                          Container(),

                        ],
                      ),
                    ),
                  ),
                ],
              )


        ),
      );
  }

  //点击柱状图触发的函数
  _onSelectionChanged(charts.SelectionModel model) {
    final selectedDatum = model.selectedDatum;
    print(selectedDatum.first.datum.time);
    // setState(() {
      //改变两个显示的数值
      _year = quxianbean.result[selectedDatum.first.datum.time].showTime;
      _sales = selectedDatum.first.datum.data;
      if(sel==0){
        textKey.currentState.onPressed("时间："+_year+":00     数值："+_sales.toString());
      }else{
        textKey.currentState.onPressed("时间："+_year+"     数值："+_sales.toString());
      }

    // });
  }


  ///接收选择的结果
  void handleSelect (Map targetArea) {
    setState(() {
      selectArea = targetArea;
      getFuHeList();
      // initData(selectArea['proviceIndex'],selectArea['cityIndex']);
    });
  }
  @override
  void initState() {
    super.initState();
    DioUtils.createInstance();
  }


  @override
  void dispose() {
//    _amapLocation.stopLocate();
    super.dispose();
  }
  var time = formatDate(new DateTime.now(),[yyyy,'-',mm,"-",dd]);
  var time2 = formatDate(new DateTime.now(),[yyyy,'-',mm]);
  void getFuHeList() async {
    if(null!=textKey&&null!= textKey.currentState) {
      textKey.currentState.onPressed("时间：");
    }
    showDialog(
        context: context,
        builder: (context) {
          return new LoadingDialog();
        });
    try {

      Response response;
      if(searchType==0){
        response = await DioUtils.dio.get(DioUtils.API_PREFIX+"/loadForecast/getLoadForecast?types="+ sel.toString()+"&&meterId="+selectArea['id']);
      }else{
        response = await DioUtils.dio.get(DioUtils.API_PREFIX+"/loadForecast/getLoadForecast?types="+ sel.toString()+"");
      }

      Map respMap = json.decode(response.data);
      quxianbean  = LoadForecastBean.fromJson(respMap);
      Navigator.pop(context);
      if (quxianbean.code == 0) {
        if(quxianbean.result.length>0){
          hasdata=true;
          setState(() {

          });
        }else{
          LocalToast.toast(context,msg: "未查询到数据");
        }

      } else {
        LocalToast.toast(context,msg: quxianbean.message);
      }
    } catch (e) {
      Navigator.pop(context);
      LocalToast.toast(context,msg: "请选择线路");
    }
  }

  void updatefuheyuce() async {
    showDialog(
        context: context,
        builder: (context) {
          return new LoadingDialog();
        });
    // Navigator.pop(context);
    try {

      // var reqeuest =Map<Object,Object>();
      // reqeuest["types"] = sel.toString();
      // reqeuest["meterId"] = selectArea['id'];
      // reqeuest["showTime"] = getShowTime();
      // reqeuest["instantFlow"] = phoneController.text;
      Response response;
        response = await DioUtils.dio.get(DioUtils.API_PREFIX+"/loadForecast/updateLoadForecast"
            "?types="+sel.toString()+"&&meterId="+selectArea['id']+"&&showTime="+getShowTime()+"&&instantFlow="+phoneController.text);



          // , data: json.encode(reqeuest));
      Map respMap = json.decode(response.data);
     basebean bean  = basebean.fromJson(respMap);
      Navigator.pop(context);
      if (bean.code == 0) {
        getFuHeList();
      } else {
         LocalToast.toast(context,msg: quxianbean.message);
      }
    } catch (e) {
      Navigator.pop(context);
       LocalToast.toast(context,msg: "请选择线路");
    }
  }
   String getShowTime(){
    if(sel==0){
      if(hourController.text.length>1){
        return ((int.parse(hourController.text))).toString();
      }else{
        return "0"+((int.parse(hourController.text))).toString();
      }
    }else{
      return time;
    }
  }

  void updatefuheyuceread() async {
    showDialog(
        context: context,
        builder: (context) {
          return new LoadingDialog();
        });
    // Navigator.pop(context);
    try {

      var reqeuest =Map<Object,Object>();
      reqeuest["types"] = sel.toString();
      reqeuest["meterId"] = selectArea['id'];
      Response response;

        response = await DioUtils.dio.put(DioUtils.API_PREFIX+"/loadForecast/isHaveRead?types="+sel.toString()+"&&meterId="+selectArea['id'], data: json.encode(reqeuest));


      Map respMap = json.decode(response.data);
      basebean bean  = basebean.fromJson(respMap);
      Navigator.pop(context);
      if (bean.code == 0) {
        getFuHeList();
      } else {
        LocalToast.toast(context,msg: quxianbean.message);
      }
    } catch (e) {
      Navigator.pop(context);
      LocalToast.toast(context,msg: "请选择线路");
    }
  }

  List<SeriesDatas> data1(){
    List<SeriesDatas> listdata = new List<SeriesDatas>();
    // SeriesDatas data = new SeriesDatas(
    //     "0", 0);
    // listdata.add(data);
    for(int i =0;i< quxianbean.result.length;i++){
      SeriesDatas data = new SeriesDatas(
          i, quxianbean.result[i].instantFlow);
      listdata.add(data);
    }
    return listdata;
  }

  // List<SeriesDatas> data2(){
  //   List<SeriesDatas> listdata = new List<SeriesDatas>();
  //   SeriesDatas data = new SeriesDatas(
  //      0, 0);
  //   listdata.add(data);
  //   for(int i =1;i<quxianbean.result.loadForecastCurveVoList.length+1;i++){
  //       SeriesDatas data = new SeriesDatas(
  //           i, quxianbean.result.loadForecastCurveVoList[i-1].yvalue);
  //       listdata.add(data);
  //   }
  //   return listdata;
  // }


  // 折线图
  Widget _chartWidget() {

    var seriesList = [
      new charts.Series(
        id: '预测用热量(t)',
        colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
        domainFn: (SeriesDatas sales, _) => sales.time,
        measureFn: (SeriesDatas sales, _) => sales.data,
        data: data1(),
      ),

    ];

    var chart = new charts.LineChart(
      seriesList,
      animate: true,

      defaultRenderer: charts.LineRendererConfig( // 折线图绘制的配置
        includeArea: true,
        includePoints: false,
        includeLine: true,
        stacked: false,
      ),
      selectionModels: [
        charts.SelectionModelConfig(
          type: charts.SelectionModelType.info,
          changedListener: _onSelectionChanged,
        )
      ],
      domainAxis: charts.NumericAxisSpec( // 主轴的配置
        // tickFormatterSpec: DomainFormatterSpec(widget.dateRange), // tick 值的格式化，这里把 num 转换成 String
        renderSpec: charts.SmallTickRendererSpec( // 主轴绘制的配置
          tickLengthPx: 0, // 刻度标识突出的长度
          labelOffsetFromAxisPx: 12, // 刻度文字距离轴线的位移
          labelStyle: charts.TextStyleSpec( // 刻度文字的样式
            fontSize: 0,
          ),
          axisLineStyle: charts.LineStyleSpec( // 轴线的样式
          ),
        ),
        tickProviderSpec: charts.BasicNumericTickProviderSpec( // 轴线刻度配置
          dataIsInWholeNumbers: false,
          desiredTickCount: quxianbean.result.length+1, // 期望显示几个刻度
        ),
      ),
      primaryMeasureAxis: charts.NumericAxisSpec( // 交叉轴的配置，参数参考主轴配置
        showAxisLine: false, // 显示轴线
        // tickFormatterSpec: MeasureFormatterSpec(),
        tickProviderSpec: charts.BasicNumericTickProviderSpec(
          dataIsInWholeNumbers: false,
          desiredTickCount: 6,
        ),
        renderSpec: charts.GridlineRendererSpec( // 交叉轴刻度水平线
          tickLengthPx: 0,
          labelOffsetFromAxisPx: 12,
          labelStyle: charts.TextStyleSpec(
            // color: ChartUtil.getChartColor(HColors.lightGrey),
            fontSize:10,
          ),
          lineStyle: charts.LineStyleSpec(
            // color: ChartUtil.getChartColor(ChartUtil.lightBlue),
          ),
          axisLineStyle: charts.LineStyleSpec(
            // color: ChartUtil.getChartColor(ChartUtil.lightBlue),
          ),
        ),
      ),
      behaviors: [
        new charts.SeriesLegend(
          // 图例位置 在左侧start 和右侧end
          position: charts.BehaviorPosition.top,
          // 图例条目  [horizo​​ntalFirst]设置为false，图例条目将首先作为新行而不是新列增长
          horizontalFirst: false,
          // 每个图例条目周围的填充Padding
          cellPadding: new EdgeInsets.only(right: 4.0, bottom: 4.0),
          // 显示度量
          showMeasures: true,
          // 度量格式
          measureFormatter: (num value) {
            return value == null ? '-' : '${value}';
          },
        ),

      ],
    );

    return new Card(
      child: Container(
        height: 234,
        // padding: new EdgeInsets.fromLTRB(16, 10, 16, 20),
        // margin: new EdgeInsets.only(bottom: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              children: <Widget>[
                Flexible(fit: FlexFit.tight, child: SizedBox()),
                Text("日:"),
                Radio(
                  value: 0,
                  groupValue: this.sel,
                  onChanged: (value) {
                    this.sel = value;
                    getFuHeList();
                  },
                ),
                Text("周:"),
                Container(
                  child:
                  Radio(
                    value: 1,
                    groupValue: this.sel,
                    onChanged: (value) {
                      this.sel = value;
                      getFuHeList();
                    },
                  ),
                ),

                Text("月:"),
                Radio(
                  value: 2,
                  groupValue: this.sel,
                  onChanged: (value) {
                    this.sel = value;
                    getFuHeList();
                  },
                )
              ],
            ),
            new Center(
              child: new Text(
                '负荷预测',
                style: TextStyle(
                  color: Color.fromRGBO(0, 0, 0, 1.0), //opacity：不透明度
                  fontFamily: 'PingFangBold',
                  fontSize: 15.0,
                ),
              ),
            ),

            new SizedBox(
              height: 150.0,
              child: chart,
            ),
            new Center(
              child: TextWidget(textKey),
            ),
          ],
        ),
      ),
    );

  }


}